" 测试条件判断和循环语句的VimL程序

" 测试基本的if/else语句
let x = 10
if (x > 5)
    echo "x is greater than 5"
else
    echo "x is not greater than 5"
endif

" 测试if/elseif/else语句
let y = 0
if (y > 0)
    echo "y is positive"
elseif (y < 0)
    echo "y is negative"
else
    echo "y is zero"
endif

" 测试while循环
let i = 0
while (i < 3)
    echo "while loop: " . i
    let i = i + 1
endwhile

" 测试for循环（使用while模拟）
let j = 0
let max = 5
while (j < max)
    echo "for loop: " . j
    let j = j + 1
endwhile

" 测试嵌套条件
let a = 5
let b = 10
if (a < b)
    if (a == 5)
        echo "a equals 5 and is less than b"
    endif
endif

echo "control flow test finished"